import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiProperty } from "@nestjs/swagger";
import { ConstraintMetadata } from 'class-validator/types/metadata/ConstraintMetadata';
import { UserService } from "./user.service";

class CreateUseDto {
    @ApiProperty({ description: "用户id" })
    uid: number
}

@Controller('user')
@ApiTags("用户")
export class UserController {
    constructor(
        private userService: UserService
    ) { }
    @Get("list")
    @ApiOperation({ summary: '用户列表' })
    async user() {
        return await this.userService.getAll();
    }
    @Post()
    @ApiOperation({ summary: '创建新用户' })
    createUser(@Body() body: CreateUseDto) {

        return {
            success: true
        }
    }
    @Get(':id')
    deuser(@Query() query): string {
        console.log(query)
        return "用户控制器"
    }
}
